// API 端点配置 - 基于后端 Java 控制器
const API_ENDPOINTS = {
  // 用户相关 API (对应 UserController)
  USER: {
    // 用户登录
    LOGIN: '/api/user/login',
    
    // 用户注册/创建
    CREATE: '/api/user/create',
    
    // 更新用户信息
    UPDATE: '/api/user/update',
    
    // 获取用户列表
    LIST: '/api/user/list',
    
    // 分页查询用户
    PAGE: '/api/user/page',
    
    // 获取用户详情
    GET_INFO: (id) => `/api/user/getInfo/${id}`,
    
    // 删除用户
    DELETE: (id) => `/api/user/delete/${id}`
  },
  
  // 认证相关 (兼容旧版本)
  AUTH: {
    LOGIN: '/api/user/login',
    REGISTER: '/api/user/create',
    LOGOUT: '/api/user/logout', // 后端可能没有此接口
    REFRESH_TOKEN: '/api/user/refresh', // 后端可能没有此接口
    VERIFY_TOKEN: '/api/user/verify' // 后端可能没有此接口
  },
  
  // 案件相关 (需要后端实现)
  CASE: {
    LIST: '/api/cases',
    DETAIL: (id) => `/api/cases/${id}`,
    CREATE: '/api/cases',
    UPDATE: (id) => `/api/cases/${id}`,
    DELETE: (id) => `/api/cases/${id}`,
    MATERIALS: (id) => `/api/cases/${id}/materials`,
    STATISTICS: '/api/cases/statistics',
    ASSIGN: (id) => `/api/cases/${id}/assign`,
    STATUS: (id) => `/api/cases/${id}/status`
  },
  
  // 律师相关 (需要后端实现)
  LAWYER: {
    LIST: '/api/lawyers',
    DETAIL: (id) => `/api/lawyers/${id}`,
    CREATE: '/api/lawyers',
    UPDATE: (id) => `/api/lawyers/${id}`,
    DELETE: (id) => `/api/lawyers/${id}`,
    VERIFY: (id) => `/api/lawyers/${id}/verify`,
    SPECIALTIES: '/api/lawyers/specialties'
  },
  
  // 系统相关 (需要后端实现)
  SYSTEM: {
    STATISTICS: '/api/statistics',
    CONFIG: '/api/system/config',
    MENU: '/api/system/menu',
    UPLOAD: '/api/upload/file',
    HEALTH: '/api/health'
  },
  
  // 文件上传 (需要后端实现)
  UPLOAD: {
    FILE: '/api/upload/file',
    IMAGE: '/api/upload/image',
    DOCUMENT: '/api/upload/document',
    AVATAR: '/api/upload/avatar'
  },
  
  // WebSocket (需要后端实现)
  WEBSOCKET: {
    NOTIFICATIONS: '/ws/notifications',
    CHAT: '/ws/chat',
    CASE_UPDATES: '/ws/case-updates'
  }
}

// 获取完整的 API URL
export const getApiUrl = (endpoint) => {
  const baseUrl = import.meta.env.VITE_API_BASE_URL || 'http://localhost:8080'
  return `${baseUrl}${endpoint}`
}

// 导出端点配置
export default API_ENDPOINTS

// 导出常用端点
export const {
  USER,
  AUTH,
  CASE,
  LAWYER,
  SYSTEM,
  UPLOAD,
  WEBSOCKET
} = API_ENDPOINTS 